<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // es5写法
        function fn(x) {
            x = x || 0
            return x
        }
        console.log(fn())//0

        /*es6写法*/
        function fn2(x = 0) {
            return x
        }
        console.log(fn2())//0



    </script>
</body>

</html>